Skip to content

Conversation

@j-madrone
Copy link
Collaborator

@j-madrone j-madrone commented Sep 24, 2025

This pull request introduces a major refactor to how user authentication profiles are managed, replacing the legacy credentials file with a new profiles file and updating all related logic and messaging to match. It also updates project-specific configuration handling, switching from .workato/ directories to a single .workatoenv file, and ensures these are properly excluded from version control and packaging. Additionally, there are supporting updates for OpenAPI client generation and dependency management.

Profiles and Credentials Refactor:

  • Replaced the global ~/.workato/credentials file with ~/.workato/profiles throughout the codebase, including the data model (CredentialsConfigProfilesConfig), file paths, and all related logic in ProfileManager and CLI commands. All messages and documentation now reference profiles instead of credentials. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

Project Configuration and Exclusion Updates:

  • Migrated project-specific configuration from a .workato/ directory to a single .workatoenv file, updating all helper functions, config management, and exclusion logic in commands such as pull and push to reference .workatoenv instead of .workato/. Ensured .workatoenv is added to .gitignore and excluded from packaging and file deletion. [1] [2] [3] [4]

Dependency and Tooling Improvements:

  • Added openapi-generator-cli as a development dependency in pyproject.toml and introduced a local pre-commit hook for generating OpenAPI clients, streamlining API client updates for the project. [1] [2]

Housekeeping and Versioning:

  • Updated the version string in _version.py to reflect the new release.
  • Removed generated test files from the OpenAPI client directory listing for cleaner source control.

- Replaced references to `~/.workato/credentials` with `~/.workato/profiles` throughout the codebase to align with the new configuration structure.
- Updated `.gitignore` to exclude `.workatoenv` instead of `.workato/`.
- Refactored `ProfileManager` and `ConfigManager` to manage profiles instead of credentials, enhancing clarity and functionality.
- Adjusted unit tests to reflect changes in configuration file handling and ensure proper validation of profiles.
- Improved error messages and user feedback in CLI commands related to profile management.
Copilot AI review requested due to automatic review settings September 24, 2025 17:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the Workato CLI configuration system to replace the workato/ directory approach with a .workatoenv file-based system and renames the credentials configuration from "credentials" to "profiles".

  • Replace workato/ directories with .workatoenv files for project configuration
  • Rename credentials file to profiles file (~/.workato/credentials~/.workato/profiles)
  • Update related functionality including gitignore patterns, file exclusion logic, and test cases

Reviewed Changes

Copilot reviewed 15 out of 18 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/unit/test_config.py Updates test cases to use ProfilesConfig instead of CredentialsConfig and test profiles file operations
tests/unit/commands/test_push.py Changes test to exclude .workatoenv file instead of workato/ directory
tests/unit/commands/test_pull.py Updates gitignore and merge logic tests to handle .workatoenv instead of workato/
tests/unit/commands/test_profiles.py Updates profile command tests to reference profiles file instead of credentials
tests/unit/commands/projects/test_project_manager.py New comprehensive test file for ProjectManager functionality
tests/unit/commands/projects/test_command.py New comprehensive test file for project CLI commands
src/workato_platform/cli/utils/exception_handler.py Minor text update removing "or expired" from auth error message
src/workato_platform/cli/utils/config.py Major refactoring to use ProfilesConfig, .workatoenv files, and updated directory detection
src/workato_platform/cli/commands/push.py Updates file exclusion logic for .workatoenv instead of workato/ directory
src/workato_platform/cli/commands/pull.py Updates gitignore and merge logic for .workatoenv file handling
src/workato_platform/cli/commands/profiles.py Updates profile command text to reference profiles file and keyring
src/workato_platform/_version.py Version bump to 0.1.dev27
src/.openapi-generator/FILES Removes test files from generated client
pyproject.toml Adds openapi-generator-cli dependency
.pre-commit-config.yaml Adds client generation hook

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@j-madrone j-madrone requested a review from oalami September 24, 2025 17:15
- Updated the GitHub Actions workflow to include permissions for pull requests and added a coverage report generation step.
- Modified the test execution command to run with coverage and added a step to comment on the pull request with the coverage report.
- Refactored the API client configuration in
@github-actions
Copy link

github-actions bot commented Sep 24, 2025

Coverage

Coverage Report
FileStmtsMissCoverMissing
__init__.py52296%10–11
cli
   __init__.py340100% 
   containers.py270100% 
cli/commands
   __init__.py00100% 
   api_clients.py286996%24, 297, 442–443, 476, 486, 576, 607, 615
   api_collections.py253398%25, 178, 340
   assets.py46295%51–52
   connections.py520599%578, 580, 586, 624, 973
   data_tables.py163596%28, 248, 262, 316–317
   guide.py166199%106
   init.py410100% 
   profiles.py1470100% 
   properties.py95198%18
   pull.py171298%184–185
   workspace.py38294%57, 67
cli/commands/connectors
   __init__.py00100% 
   command.py88297%103, 152
   connector_manager.py203498%176, 292, 300–301
cli/commands/projects
   __init__.py00100% 
   command.py2691096%353–356, 367, 433–435, 485, 489
   project_manager.py166795%48, 66, 263–264, 276, 317, 325
cli/commands/push
   __init__.py00100% 
   command.py132496%101, 104, 222, 300
cli/commands/recipes
   __init__.py00100% 
   command.py423997%113, 129–130, 267–270, 397, 703
   validator.py6991697%174, 870, 1123, 1210, 1300–1302, 1398–1399, 1458–1459, 1648–1649, 1677–1679
cli/utils
   __init__.py30100% 
   exception_handler.py149695%111, 135, 150, 165, 196, 231
   gitignore.py140100% 
   ignore_patterns.py230100% 
   spinner.py430100% 
   version_checker.py135695%24, 26, 33–34, 72, 102
cli/utils/config
   __init__.py50100% 
   manager.py4641397%121, 132–134, 137, 149, 328, 466, 680, 838–839, 900, 959
   models.py330100% 
   profiles.py3091096%93, 189–190, 193, 228–230, 255–257
   workspace.py680100% 
TOTAL526511997% 

@oalami oalami self-assigned this Sep 24, 2025
oalami
oalami previously approved these changes Sep 24, 2025
Copy link
Collaborator

@oalami oalami left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

- Updated the `profiles.py` command to handle exceptions when loading workspace configurations, ensuring a fallback to default configuration data.
- Enhanced unit tests for profile commands to cover various scenarios, including workspace context handling and error management.
- Improved the `make_config_manager` function to streamline mock configuration for tests.
- Added tests for the `ProfileManager` to validate token retrieval and storage with fallback mechanisms in case of keyring errors.
- Updated the CLI command structure to improve command naming consistency, changing `projects.project` to `projects.projects`.
- Enhanced the `init` command to support non-interactive mode with additional parameters for profile, region, API token, and project details.
- Implemented validation for required parameters in non-interactive mode to ensure proper setup.
- Added JSON output support for listing profiles and projects, improving user experience and data accessibility.
- Refactored project management commands to streamline project listing and switching functionality.
- Updated unit tests to cover new features and ensure robust error handling in various scenarios.
- Updated type hints in various test files to enhance code clarity and maintainability.
- Improved mock usage in tests, particularly for `ProfileManager` and `ConfigManager`, to streamline test setup and execution.
- Refactored test functions to ensure consistency in parameter types and improve readability.
- Enhanced error handling in tests to better simulate real-world scenarios and edge cases.
- Adjusted the `pyproject.toml` to exclude the generated client directory and version file from linting.
- Modified the GitHub Actions workflow to remove specific exclusions from the `ruff` checks.
- Improved formatting consistency in the `ignore_patterns.py` file.
- Cleaned up the `__init__.py` file by removing unnecessary line breaks for better readability.
- Consolidated the CLI tool into a single `__init__.py` file, enhancing organization and readability.
- Removed the obsolete `cli.py` and `push.py` files to streamline the codebase.
- Updated import paths in test files to reflect the new CLI structure.
- Improved command registration and initialization process for better maintainability.
- Deleted the `test_push.py` file, which contained unit tests for the push command.
- This removal is part of a broader effort to streamline the codebase and eliminate obsolete test files.
…lity

- Updated the non-interactive mode in `init.py` to require either a profile or both region and API token, improving user feedback on missing parameters.
- Refactored the `list_projects` command in `command.py` to support listing projects from local, remote, or both sources, with enhanced output formatting for JSON and table modes.
- Improved error handling in `ConfigManager` to ensure proper validation of region and API token requirements.
- Updated unit tests to reflect changes in validation logic and project listing behavior, ensuring comprehensive coverage for new scenarios.
@j-madrone j-madrone requested a review from hovu96 September 26, 2025 13:16
- Updated the initialization logic to require either a profile name or both region and API token for non-interactive setup, enhancing user feedback on parameter requirements.
@j-madrone j-madrone merged commit 87c3373 into main Sep 26, 2025
5 checks passed
@j-madrone j-madrone deleted the update-profile-path branch September 26, 2025 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants